<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="d" uri="http://www.trkj.com/tr1702/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>"/>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$(".xinz_skill").linkbutton({
	onClick:function(){
		$("#w4_skill").dialog("open");
	}
});

//删除
$(".sc_wdm_skill").linkbutton({onClick:function(){
	var rowInfo = $("#yglz-wdm_skill").datagrid('getSelected');
	if(rowInfo){
		$.messager.confirm('确认', '您确定要删除该条数据吗？', function(v){
			if(v){
				var skillId = $("#yglz-wdm_skill").datagrid("getSelected").skillId;
				$.getJSON("delete_skill",{skillId:skillId},function(v){
					if(v){
						$('#yglz-wdm_skill').datagrid('reload');   
					}else{
						$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
					}
				});
			}
			
		});
	}else{
		$.messager.alert('错误', '对不起，操作失败，没有选中的行');
	}
	
}});
//编辑
$(".jz_wdm_skill").linkbutton({onClick:function(){
	var rowInfo = $("#yglz-wdm_skill").datagrid('getSelected');
	if(rowInfo){
		var skillId = $("#yglz-wdm_skill").datagrid("getSelected").skillId;
		var skillName = $("#yglz-wdm_skill").datagrid("getSelected").skillName;
		var skillRemark = $("#yglz-wdm_skill").datagrid("getSelected").skillRemark;
		
		$("#win2_skill").dialog("open");
		$('#reasons_for_leaving_skill2').form('load','load_skill?skillId='+skillId);
		
	}else{
		$.messager.alert('错误', '对不起，操作失败，没有选中的行');
	}
	
}});
//模糊查询
function doSearch(value,name){
	$('.yglz-wdm_skill').datagrid({ url: 'modaddSeslect_skill?text='+value});//重新指定url
    $('.yglz-wdm_skill').datagrid('load',{  
   		
    });

}




</script>
	<table id="yglz-wdm_skill" class="easyui-datagrid yglz-wdm_skill" data-options="
				url:'queryByto_skill',
				pageList:[2,4,6,8,10],
				pageSize:10,
				pagination:true,
				method:'get',
				fitColumns:true,
				fit:true,
				nowrap:false,
				autoRowHeight:true,
				singleSelect:true,
				striped:true,
				toolbar:'#wdm15_skill'
				">
			<thead>
				<tr>
					<th data-options="field:'skillId',width:50,align:'center'">技能编号</th>
					<th data-options="field:'skillName',width:50,align:'center'">技能名称</th>
					<th data-options="field:'skillRemark',width:50,align:'center'">备注</th>
					<th data-options="field:'skillPerson',width:50,align:'center'">创建者</th>
					<th data-options="field:'skillCreatordate',width:50,align:'center',
							formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
					}
					">创建日期</th>
					<th data-options="field:'skillUpdatedate',width:50,align:'center',
							formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
					}
					">更新日期</th>
					
				</tr> 
			</thead>
			<tbody>
			</tbody>
		</table>
		<d:g id="28">
		<div id="wdm15_skill">
					<a href="#" class="xinz_skill" data-options="iconCls:'icon-add',plain:true,text:'新增',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton jz_wdm_skill" data-options="iconCls:'icon-edit',plain:true,text:'编辑',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton sc_wdm_skill" id="sc_wdm_skill" data-options="iconCls:'icon-remove',plain:true,text:'删除',iconAlign:'left'"></a>| 
				搜索内容
				<input id="ss" class="easyui-searchbox sousuo"
						searcher="doSearch" prompt="请输入技能名"
						style="width: 200px; vertical-align: middle;"></input> 
</div>
</d:g>
<div id="mm" style="width:120px"> 
		</div>
		
		<div id="w4_skill" class="easyui-dialog"
			data-options="width:500,
						height:200,
						title:'定义技能',
						modal:true,
						closed:true,
						buttons:[{
					text:'添加',
					iconCls:'icon-ok',
					handler:function(){
							$('#reasons_for_leaving_skill').form({
							onSubmit:function(params){
								return $('#reasons_for_leaving_skill').form('validate');
							},success:function(v){
								v=eval('('+ v + ')');
								if(v.success){
								
									$('#w4_skill').dialog('close');
									$('#yglz-wdm_skill').datagrid('reload');
									$('#reasons_for_leaving_skill').form('reset');
								}else{
									$.messager.alert('错误', v.message);
								}
							}
						
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#w4_skill').dialog('close');
					}
				}]">
	 		<form action="insert_skill" method="post"  id="reasons_for_leaving_skill">
				<div style="margin-left:60px;margin-top:10px;">*技能名称：<input class="easyui-textbox" id="skillName" name="skillName" data-options="width:'80%',required:true"/></div>
				<div style="margin-left:60px;margin-top:20px;" >*备注：<input class="easyui-textbox" id="zcSalary" name="skillRemark" data-options="width:'80%',required:true"/></div>
			</form>
		</div>
			
			
			
		<div id="win2_skill" class="easyui-dialog"
			data-options="width:500,
						height:250,
						title:'定义职称',
						modal:true,
						closed:true,
						buttons:[{
					text:'添加',
					iconCls:'icon-ok',
					handler:function(){
						$('#reasons_for_leaving_skill2').form({
							onSubmit:function(params){
								return $('#reasons_for_leaving_skill2').form('validate');
							},success:function(v){
								v=eval('('+ v + ')');
								if(v.success){
									$('#win2_skill').dialog('close');
									$('#yglz-wdm_skill').datagrid('reload');
									$('#reasons_for_leaving_skill2').form('reset');
								}else{
									$.messager.alert('错误', v.message);
								}
							}
						
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#win2_skill').dialog('close');
					}
				}]">
	 		<form action="update_skill" method="post"  id="reasons_for_leaving_skill2" >
	 			<div style="margin-left:60px;margin-top:10px;">*技能编号：<input class="easyui-textbox" id="skillId" name="skillId" data-options="width:'80%',readonly:true"/></div>
				<div style="margin-left:60px;margin-top:10px;">*技能名称：<input class="easyui-textbox" id="skillName" name="skillName" data-options="width:'80%',required:true"/></div>
				<div style="margin-left:60px;margin-top:20px;" >*备注：<input class="easyui-textbox" id="skillRemark" name="skillRemark" data-options="width:'80%',required:true"/></div>
			</form>
		</div>			
</body>
</html>